<?php

/**
 * 
 */
class Z_Mobile_Page extends Z_Component {

    private $title;
    private $id;
    private $content;
    private $footer;
    private $headerButtons;
    private $headerNavButtons;
    private $footerButtons;

    public $headerFixed = false;
    public $footerFixed = false;

    public function __construct($title="",$id="") {
        parent::__construct("<div data-role=\"page\" data-theme=\"".Z_App::getConf()->theme->page."\" id=\"{$id}\" >","</div>");
        $this->title = $title;
        $this->content = array();
        $this->headerButtons = array();
	$this->footerButtons = array();
    }

    public function add($content)
    {
        $this->content[] = $content;
    }

    public function addHeaderButton($position, $title, $url, $icon="", $isDialog=false, $transition="") {
        $this->headerButtons[] = new Z_Html_Link($url, $title, $transition, $isDialog, $icon, $position);
    }

    public function addHeaderNavButton($title, $url, $icon="", $isDialog=false, $transition="") {
        $this->headerNavButtons[] = new Z_Html_ListLink($url, $title, $transition, $isDialog, $icon);
    }

    public function addFooterButton($position, $title, $url, $icon="", $isDialog=false, $transition="") {
        $this->footerButtons[] = new Z_Html_Link($url, $title, $transition, $isDialog, $icon, $position);
    }



    public function render()
    {

        parent::add(new Z_Mobile_Header($this->title,$this->headerButtons,$this->headerNavButtons,$this->headerFixed));
        parent::add(new Z_Mobile_Content($this->content));
        parent::add(new Z_Mobile_Footer($this->footerButtons,$this->footerFixed));
 
        return parent::render();
    }

}